<?php

$app->match('/', function() use ($app) {
    return $app['twig']->render('homepage.html.twig');
})
->bind('homepage');

$app->error(function (\Exception $e, $code) use ($app) {
    if (true === $app['debug']) {
        return;
    }
    
    $errorPage = 'error.html.twig';
    if (404 === $code) {
        $errorPage = 'page-not-found.html.twig';
    }

    return $app['twig']->render($errorPage, array('code' => $code));
});

return $app;
